import { createApp } from 'vue'

// 全局样式
import '@/styles/index.scss'

import App from './App.vue'
import pinia from '@/store'

// 创建实例
const app = createApp(App)

// elementUI 图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  let name = 'el-icon-' + key.toLowerCase()
  app.component(name, component)
  // app.component(key, component)
}

// 添加饿了么组件库
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
app.use(ElementPlus)

app.use(pinia)

// 注册路由
import router from './router'
app.use(router)

// 配置导航守卫
import '@/router/guard.ts'

app.mount('#app')
